package com.mxx.common.payment;


import java.util.Map;

public interface PaymentHandler<T extends PrepaymentResponse> {

    /**
     * 预下单
     *
     * @param tradeMark 下单明细
     * @return PrePaymentResponse
     */
    T prepaymentProcess(TradeMark tradeMark);

    /**
     * 处理预下单回调
     *
     * @param params params
     */
    void paymentFallback(FinishTradeHandler paymentHandler, Map<String, String> params);

    /**
     * 支付订单id
     *
     * @param orderNo 订单ID
     * @return
     */
    PayResponse close(String orderNo);

    /**
     * 退款
     *
     * @param outTradeNo   订单号
     * @param refundAmount 退款金额
     * @param refundReason 退款原因
     */
    void refund(FinishTradeHandler finishTradeHandler, String outTradeNo, String totalAmount, String refundAmount, String refundReason);

    /**
     * 处理退款回调
     *
     * @param params params
     */
    boolean analysisOfRefund(FinishTradeHandler paymentHandler, Map<String, String> params);

    /**
     * 查询订单
     *
     * @param outTradeNo 支付订单id
     * @return PayResponse
     */
    void selectPayment(FinishTradeHandler finishTradeHandler,String outTradeNo);

    /**
     * 退款查询
     *
     * @param outTradeNo      支付订单id
     * @param operatorId 体检订单id
     * @return PayResponse
     */
    PayResponse selectOfRefund(String outTradeNo, String operatorId);

    TradeType getTradeType();
}
